<?php
	class Model_order extends CI_Model{
		private $_table = "tbl_orders";
		public function __construct(){
			parent::__construct();
			$this->load->database();
		}
		public function insert($data){
			$this->db->insert($this->_table,$data);
		}
		public function update($id,$data){
			$this->db->where("order_ran",$id);
			$this->db->update($this->_table,$data);
		}
		public function update_back($id,$data){
			$this->db->set('don_date', 'now()', FALSE);
			$this->db->where("order_ran",$id);
			$this->db->update($this->_table,$data);
		}
		public function getdata($id,$type){
			switch($type){
			   case "tours" : $sql = "select * from tbl_tours where tour_id = '".$id."'";
			   		break;
			   case "hottel" : $sql = "select * from tbl_hottels where hottel_id = '".$id."'";
			   		break;
			   case "cruise" : $sql = "select * from tbl_cruises where cruise_id = '".$id."'";
			   		break;
			   default : $tbl = ""; die("false"); break;
		   }
		   $data = $this->db->query($sql);
		   return $data->row_array();
		}
	}